package com.demo.quartz.jobs;

import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Random;

/**
 * @author chenx
 * @Description :
 * @create 2020-05-15 10:22
 */
public class PrintWordsJob implements Job {
    public  static  void  main(String args[]){
        long start = System.currentTimeMillis();
        long index=0;
        for(int i=0;i<8000;i++){
            for (int j=0;j<200000;j++){
                index++;
//                System.out.println(index);
            }
        }
        long end = System.currentTimeMillis();//65ms,86ms,112ms
        System.out.println("耗时："+(end-start)+"ms"+"-->index-->"+index);
        System.out.println("************************");
    }
    //任务逻辑
    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {

        String printTime = new SimpleDateFormat("yy-MM-dd HH-mm-ss").format(new Date());
        System.out.println("PrintWordsJob start at:" + printTime + ", prints: Hello Job-" + new Random().nextInt(100));

    }
}
